package com.sayyi.demo.micro.order.controller;


import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.sayyi.demo.micro.order.entity.OrderTbl;
import com.sayyi.demo.micro.order.service.IOrderTblService;
import com.sayyi.demo.micro.storage.api.StorageApi;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2022-02-21
 */
@RestController
@RequestMapping("/order/order-tbl")
public class OrderTblController {

    @Autowired
    private IOrderTblService orderTblService;

    @SentinelResource("OrderTblController:at")
    @PostMapping("/")
    public int createOrder(OrderTbl orderTbl) {
        return orderTblService.createOrder(orderTbl);
    }

    @SentinelResource("OrderTblController:tcc")
    @PostMapping("/tcc")
    public int createOrderByTcc(OrderTbl orderTbl) {
        return orderTblService.createOrderByTcc(orderTbl);
    }

    @SentinelResource("OrderTblController:saga")
    @PostMapping("/saga")
    public int createOrderBySaga(OrderTbl orderTbl) {
        return orderTblService.createOrderBySaga(orderTbl);
    }
}
